<template>
  <page-header :title="tabs.name" :menuId="tabs.id" />
  <template v-for="(item, index) in tabs.functions" :key="index">
    <green-credit v-if="item.enName === ModuleMap.GREEN_CREDIT && item.status === 0" :menuId="item.id" :count="item.count" :title="item.name" />
    <green-bond v-if="item.enName === ModuleMap.GRENN_BOND && item.status === 0" :menuId="item.id" :title="item.name"/>
    <green-bond-project v-if="item.enName === ModuleMap.GREEN_PROJECT && item.status === 0" :menuId="item.id" :title="item.name"/>
    <carbon-reduction v-if="item.enName === ModuleMap.CARBON_REDUCTION && item.status === 0" :menuId="item.id" :count="item.count" :title="item.name" />
    <insurance-company v-if="item.enName === ModuleMap.INSURANCE_COMPANY && item.status === 0" :menuId="item.id" :count="item.count" :title="item.name" />
    <insurance-policyholder v-if="item.enName === ModuleMap.INSURANCE_POLICYHOLDER && item.status === 0" :menuId="item.id" :count="item.count" :title="item.name" />
    <insurance-subsidies v-if="item.enName === ModuleMap.INSURANCE_SUBSIDIES && item.status === 0" :menuId="item.id" :count="item.count" :title="item.name" />
    
  </template>
</template>

<script lang="ts" setup>
import PageHeader from '../../components/page-header.vue';
import greenCredit from './modules/green-credit/index.vue';
import carbonReduction from './modules/carbon-reduction/index.vue';
import greenBond from './modules/green-bond/index.vue';
import greenBondProject from './modules/green-bond-project/index.vue';
import insuranceCompany from './components/insurance_company/index.vue';
import insurancePolicyholder from './components/insurance_policyholder/index.vue';
import insuranceSubsidies from './components/insurance_subsidies/index.vue';

interface Props {
  tabs: Record<string, any>;
}

const { tabs } = defineProps<Props>();

enum ModuleMap {
  /** 绿色信贷 */
  GREEN_CREDIT = 'green_credit',
  /** 绿色债券 */
  GRENN_BOND = 'greenBond',
  /**  绿色债券项目*/
  GREEN_PROJECT = 'greenProject',
  /** 碳减排工具 */
  CARBON_REDUCTION = 'carbonReduction',
  /** 纳入环责险 */
  INSURANCE_COMPANY = 'insurance_company',
  /** 投保环责险 */
  INSURANCE_POLICYHOLDER = 'insurance_policyholder',
  /** 环责险补贴 */
  INSURANCE_SUBSIDIES = 'insurance_subsidies'
}
</script>
